<?php

namespace common\models\agreement;

use Yii;

/**
 * This is the model class for table "{{%agreement}}".
 *
 * @property int $id
 * @property string $title 标题
 * @property string|null $description 导读描述
 * @property string $context 详情内容
 * @property int $need_agree 需要同意
 * @property int $duration 展示时长
 * @property int $page_id 页面ID
 * @property string|null $mark 备注
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class Agreement extends \common\db\ActiveRecord {

    const STATUS_ACTIVE = 10;
    const STATUS_DEFAULT = 0;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%agreement}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['title', 'context'], 'required'],
            [['context'], 'string'],
            [['need_agree', 'duration', 'page_id', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['title', 'description', 'mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'title' => '标题',
            'description' => '导读描述',
            'context' => '详情内容',
            'need_agree' => '需要同意',
            'duration' => '展示时长',
            'page_id' => '页面ID',
            'mark' => '备注',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

    /**
     * @inheritdoc
     */
    public function fieldConfigs() {
        return [
            'id',
            'title',
            'mark',
            'duration',
            'context',
        ];
    }

}
